<script setup>
import { artGetChannelsService } from '@/api/article.js'
import { ref } from 'vue'

defineProps({
  modelValue: {
    type: [Number,String]
  },
  width: {
    type: String
  }
})

const emit = defineEmits(['update:cid'])

const channelList = ref([])
const getChannelList = async () => {
  const res = await artGetChannelsService()
  channelList.value = res.data.data
}

getChannelList()
</script>

<template>
  <el-select :modelValue="modelValue" @update:modelValue="emit('update:modelValue',$event)" :style="{ width }" size="large">
    <el-option v-for="channel in channelList" :label="channel.cate_name" :value="channel.id"></el-option>
  </el-select>
</template>